<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>快件e栈用户登陆</title>
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body style="">
<section class="aui-flexView">
<header class="aui-navBar aui-navBar-fixed">
<a href="javascript:;" class="aui-navBar-item">

</a>
<div class="aui-center">
<span class="aui-center-title"></span>
</div>
</header>
<section class="aui-scrollView">
<div class="aui-ver-head">
<img src="images/head.png" alt="">
</div>
<div class="aui-ver-form"><img class="logo" src="images/logo.png">
<div class="aui-flex">
<div class="aui-flex-box">
<i class="icon icon-phone"></i>
<input id="phone" type="text" autocomplete="off" placeholder="手机号码" value="15365478953">
</div>
</div>
<div class="aui-flex">
<div class="aui-flex-box">
<i class="icon icon-code"></i>
<input id="authCode" type="text" autocomplete="off" placeholder="验证码">
</div>
<div class="aui-button-code">
<input id="btnSendCode" type="button" class="btn btn-default" value="获取验证码" onclick="sendMessage()">
</div>
</div>
<div class="aui-ver-button">
<button onclick="binding()">立即登录 / 注册</button>
</div>
<div class="aui-cell-box">
<label class="cell-right">
<input type="checkbox" value="1" name="checkbox" checked="checked">
<i class="cell-checkbox-icon"></i>
<em>同意快递e栈注册协议</em>
</label>
</div>
</div>
</section>
</section>
<div>
    <p align="center" class="copytxt"><a href="https://blog.csdn.net/yeahPeng11" target="_blank">Copyright &copy;2021彭德华版权声明</a></p>
</div>

<script src="js/jquery.min.js"></script>
<script src="/layer/layer.js"></script>
<script type="text/javascript">
	var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
	var count = 10;
	var InterValObj;
	var curCount;
	function sendMessage() {
		curCount = count;
		var phone = $.trim($('#phone').val());
		if (!phoneReg.test(phone)) {
			layer.msg("请输入有效的手机号码");
			return false;
		}

		$("#btnSendCode").attr("disabled", "true");
		$("#btnSendCode").val( + curCount + "秒再获取");
		InterValObj = window.setInterval(SetRemainTime, 1000);

		//发送短信
        // 以下为自己编写
        var windowId = layer.load();
        $.getJSON("/front/userLoginSms.do",{userPhone:phone},function (data){//返回的data里面有authCode
            layer.close(windowId);
            layer.msg(data.result);
            //把后台返回来数据直接填充到验证码处
            $("#authCode").val(data.data);
        })
	}

	function SetRemainTime() {
		if (curCount == 0) {
			window.clearInterval(InterValObj);
			$("#btnSendCode").removeAttr("disabled");
			$("#btnSendCode").val("重新发送");
		} else {
			curCount--;
			$("#btnSendCode").val( + curCount + "秒再获取");
		}
	}

	function binding(){
        if(!$(":checkbox").prop("checked")){
            layer.msg("未勾选协议,无法登陆");
            return;
        }
        //获取登陆所需的参数
        var userPhone = $.trim($('#phone').val());
        var userAuthCode = $.trim($('#authCode').val());
        var windowId = layer.load();
        $.post("/front/login.do",{userPhone:userPhone,userAuthCode:userAuthCode},function (data){
            layer.close(windowId);
            if(data.status == 0){
                //用户/快递员登录成功
                window.location.href = "index.html";
            }
            layer.msg(data.result);
        },"JSON");
    }
</script>

</body></html>